<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .red {
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <p
        v-for="(item, index) in list"
        :key="index"
        :class="{red: show === index}"
        @click="show = index"
      >
        {{ item }}
      </p>
    </div>

    <script src="../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          list: [111, 222, 333],
          show: 0,
        },
      });
    </script>
  </body>
</html>
